home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Development
/
General
/
CIncludesTool
/
modified version
/
source files
/
filenames.c
< prev
next >
Wrap
Text File
|
1991-08-28
|
1KB
|
77 lines
// filenames.c
//
// file functions for CIncludesCode MPW tool
#include "CIncludesCode.h"
#include <Memory.h>
#include <Packages.h>
#include <StdIO.h>
#include <String.h>
extern long numFiles;
extern ptrArray *argvPtr;
extern strArray **filesHdl;
short maxFilename(void)
// returns length of longest filename
{
short i;
short len;
short maxname = 0;
for (i = 0; i < numFiles; ++i)
{
len = (short) strlen((**filesHdl)[i]);
maxname = len > maxname ? len : maxname;
} // for i
return maxname;
} // maxFilename()
short getFileIndex(char *s)
// looks for s in Filename array
{
short i;
for (i = 0; i < numFiles; ++i)
{
if (equalStringsUncased(s,(**filesHdl)[i]))
{
return i;
} // if equalStringUncased
} // for i
return -1;
} // getFileIndex()
void makeFilenameArray(void)
{
short i;
fprintf(stderr,"Making Filename Array...\n");
fprintf(stderr,"Number of CInclude Files = %d\n",numFiles);
filesHdl = (strArray**) NewHandle (numFiles * 32);
checkMemory();
for (i = 0; i < numFiles; ++i)
{
copyNames((**filesHdl)[i],(*argvPtr)[i + 2]);
} // for i
} // makeFilenameArray()
void printFilenameArray(void)
{
short i;
fprintf(stderr,"\nFile List:\n");
for (i = 0; i < numFiles; ++i)
{
fprintf(stderr,"%5d %s\n",i,(**filesHdl)[i]);
} // for i
} // printFilenameArray()
// end of filenames.c